package com.cheng.base;

/**
 * User: cheng
 * Date: 2014/3/24
 * Time: 18:30
 */
public class StaticTest {

    public static final StaticTest INSTANCE = new StaticTest();

    public static int tt = 0;

    public int t = 0;

    //以上变量初始化实际执行顺序为如下

//    public static StaticTest INSTANCE;
//
//    public static Integer tt;
//
//    static{
//        INSTANCE = new StaticTest();
//        tt = 0;
//    }
//
    private StaticTest(){
        System.out.println(tt);
        if(tt == 0){
            tt = 1;
        }
        t = 4;
    }

    public static void main(String[] args) {
        System.out.println("111");
        System.out.println(StaticTest.INSTANCE.tt);
        System.out.println(StaticTest.INSTANCE.tt);

        System.out.println("======================================");
        int i = 1;
        int j = 0;
        System.out.println(i);
        i++;
        System.out.println(i);
        j = i++;
        System.out.println(i);
        System.out.println(j);
    }

}
